package cn.z2huo.demo.hello.kafka.model;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *
 * @author z2huo
 */
@Data
public class ResultInfo {

    private int count;

    private Long offset;

    private List<Integer> success = new ArrayList<>();

    private List<Integer> error = new ArrayList<>();

    public void increment() {
        count++;
    }

    public void add(int count) {
        this.count += count;
    }

    public void add(ResultInfo resultInfo) {
        if (resultInfo != null) {
            this.count += resultInfo.count;
            this.success.addAll(resultInfo.getSuccess());
            this.error.addAll(resultInfo.getError());
        }
    }

}
